package hasthi.container;

import hasthi.common.HasthiException;
import hasthi.wsdm.ManagedServiceHandle;

import java.util.Map;

import javax.xml.namespace.QName;

import xsul.xservo_soap_http.HttpBasedServices;

public class Xsul2SystemHandle extends ManagedServiceHandle{
    private final ExtendedXbeanBasedService service;
    private HttpBasedServices httpBasedServices;
    public void setHttpBasedServices(HttpBasedServices httpBasedServices) {
        this.httpBasedServices = httpBasedServices;
    }

    public Xsul2SystemHandle(QName name, QName portTypeName,String description, 
            Map<QName,Object> properties, ExtendedXbeanBasedService service) throws HasthiException {
        super(name, portTypeName,description, properties);
        this.service = service;
    }

    public String getSystemEndPoint() {
        return service.getWsdlLocationToUse().replace("?wsdl", "");
    }

    public void shutDown() throws HasthiException {
//        /service.shutdownService();
        service.stopService();
        if(httpBasedServices != null){
            httpBasedServices.shutdown();
        }
    }
}
